<!--
* @description:新增外协单位
* @fileName: NewOutsourcingUnits
* @author:李周蓬
* @date:2021-1-
* @后台人员:李周蓬
-->
<template>
  <div>
    <table>
      <tr>
        <td>外协单位名称：</td>
        <td>
          <el-input
            v-model="AddData.OutsourceName"
            placeholder="请输入内容"
          ></el-input>
        </td>
      </tr>
      <tr>
        <td>手机号：</td>
        <td>
          <el-input v-model="AddData.Phone" placeholder="请输入内容"></el-input>
        </td>
      </tr>
      <tr>
        <td>邮箱：</td>
        <td>
          <el-input
            v-model="AddData.OutsourceEmail"
            placeholder="请输入内容"
          ></el-input>
        </td>
      </tr>
      <tr>
        <td>外协地址：</td>
        <td>
          <el-input
            v-model="AddData.OutsourceAddr"
            placeholder="请输入内容"
          ></el-input>
        </td>
      </tr>
      <tr>
        <td>固定电话：</td>
        <td>
          <el-input v-model="AddData.Temp" placeholder="请输入内容"></el-input>
        </td>
      </tr>
      <tr>
        <td>备注：</td>
        <td>
          <el-input type="textarea" v-model="AddData.Remark"></el-input>
        </td>
      </tr>
      <tr>
        <td>
          <el-button type="primary" @click="add">提交</el-button>
          <el-button @click="go">取消</el-button>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      AddData: {
        OutsourceNumber: "",
        OutsourceName: "",
        Phone: "",
        OutsourceEmail: "",
        OutsourceAddr: "",
        Temp: "",
        Remark: "",
      },
    };
  },
  methods: {
    add() {
      this.$axios
        .post(
          "https://localhost:44399/api/app/outsource/add-outsource",
          this.AddData
        )
        .then((res) => {
          if (res.data > 0) {
            this.$message({
              type: "success",
              message: "添加成功!",
            });
            this.$router.push("/ManagementOfOutsourcingUnits");
          } else {
            this.$message({
              type: "error",
              message: "添加失败!",
            });
          }
        });
    },
    go() {
      this.$router.go(-1);
    },
  },
};
</script>

<style>
</style>